/**
 * All rights Reserved, Designed By OprCalf
 * Copyright:    Copyright(C) 2016-2020
 * Company       LengYin Ltd.
 */

package com.platform.gateway.common.utils;

import com.platform.gateway.common.constant.ApiConstant;
import com.platform.gateway.common.message.ResponseMsg;

/**
 * @projectName:  widget-atomic-api
 * @package:      com.widget.api.utils
 * @className:    MsgUtils.java
 * @description:  消息工具类
 * @author:       OprCalf
 * @date:         2020年3月13日
 */
public class MsgUtils {

    public static <T> ResponseMsg<T> buildSuccessMsg(T data) {
        return new ResponseMsg<>(ApiConstant.SUCCESS_STATUS, ApiConstant.SUCCESS_DESC, data);
    }

    public static <T> ResponseMsg<T> buildFailureMsg(Object respDesc) {
        return new ResponseMsg<>(ApiConstant.FAILURE_STATUS, respDesc, null);
    }

    public static <T> ResponseMsg<T> buildSuccessMsg() {
        return new ResponseMsg<>(ApiConstant.SUCCESS_STATUS, ApiConstant.SUCCESS_DESC, null);
    }

    public static <T> ResponseMsg<T> buildFailureMsg() {
        return new ResponseMsg<>(ApiConstant.FAILURE_STATUS, ApiConstant.FAILURE_DESC, null);
    }
}
